<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <link rel="stylesheet" href="/backend/plugins/elementui/index.css">
    <link rel="stylesheet" href="/backend/css/login.css">
</head>
<body class="hold-transition skin-purple sidebar-mini">
<div id="app">
    <div class="login-container">
        <div class="loginBox">
            <form method="post" class="login-form" label-position="left">
                <div class="title-container"><div class="logoInfo clearfix"><em class="logo"></em></div></div>
                <div>
                    <span class="svg-container svg-container_login"><span class="user"></span></span>
                    <input type="text" v-model="user.username" placeholder="请输入用户名" />
                </div>
                <div>
                    <span class="svg-container"><span class="username"></span></span>
                    <input type="password" v-model="user.password" placeholder="请输入密码"/>
                </div>
                <input type="button" style="width:100%;margin-bottom:30px;" value="登录" @click="login()"></input>
            </form>
        </div>
    </div>
</div>
</body>
<script src="/backend/js/vue.js"></script>
<script src="/backend/plugins/elementui/index.js"></script>
<script src="/backend/js/axios-0.18.0.js"></script>
<script src="/backend/js/request.js"></script>
<script>
    var vue = new Vue({
        el: '#app',
        data: { user : {} },
        methods : {
            login(){
                axios.post('/user/login', this.user).then(res => {
                    if(res.data.flag) {
                        localStorage.setItem('token', res.data.data);
                        window.location.href='/backend/pages/main.html';
                    } else {
                        this.$message.error(res.data.message);
                    }
                });
            }
        }
    })
</script>
</html>